home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Files / XTND 1.3.6 / XTND Headers / XTNDPInterfaces / XTNDTextTranslator.p < prev   
Encoding:
Text File  |  1992-02-24  |  12.7 KB  |  327 lines  |  [TEXT/MPS ]

  1. (************************************************************************
  2. *                                                                        *
  3. *    XTNDTextTranslator.p                                                *
  4. *                                                                        *
  5. *    Header file for text translators.                                    *
  6. *                                                                        *
  7. *    Copyright © 1989-91 Claris Corporation                                *
  8. *    All Rights Reserved                                                    *
  9. *                                                                        *
  10. ************************************************************************)
  11.  
  12. {$IFC UNDEFINED UsingIncludes}
  13. {$SETC UsingIncludes := 0}
  14. {$ENDC}
  15.  
  16. {$IFC NOT UsingIncludes}
  17.     UNIT XTNDTextTranslator;
  18.     INTERFACE
  19. {$ENDC}
  20.  
  21. {$IFC UNDEFINED UsingXTNDTextTranslator}
  22. {$SETC UsingXTNDTextTranslator := 1}
  23.  
  24. {$I+}
  25. {$SETC XTNDTextTranslatorIncludes := UsingIncludes}
  26. {$SETC UsingIncludes := 1}
  27. {$IFC UNDEFINED UsingXTNDInterface}
  28. {$I XTNDInterface.p}
  29. {$ENDC}
  30. {$IFC UNDEFINED UsingPrinting}
  31. {$I Printing.p}
  32. {$ENDC}
  33. {$SETC UsingIncludes := XTNDTextTranslatorIncludes}
  34.  
  35.  
  36. CONST
  37.  
  38. { Directives to be passed to import translators }
  39.     importAcknowledge             = -1;    { Value set by a translator to acknowledge an action }
  40.  
  41.     importGetResources             = 0;
  42.     importInitAll                 = 1;
  43.  
  44.     importInitRightHeader         = 2;
  45.     importInitLeftHeader         = 3;
  46.     importInitHeader             = 4;
  47.  
  48.     importInitRightFooter         = 5;
  49.     importInitLeftFooter         = 6;
  50.     importInitFooter             = 7;
  51.  
  52.     importInitMain                 = 8;
  53.  
  54.     importInitFootnote             = 9;
  55.  
  56.     importGetText                 = 10;
  57.  
  58.     importCloseRightHeader         = 11;
  59.     importCloseLeftHeader         = 12;
  60.     importCloseHeader             = 13;
  61.  
  62.     importCloseRightFooter         = 14;
  63.     importCloseLeftFooter         = 15;
  64.     importCloseFooter             = 16;
  65.  
  66.     importCloseMain             = 17;
  67.  
  68.     importCloseFootnote         = 18;
  69.  
  70.     importCloseAll                 = 19;
  71.  
  72. { Directives to be passed to export translators }
  73.     exportAcknowledge             = -1;    { Set by translators to acknowledge certain directives }
  74.  
  75.     exportInitAll                 = 0;
  76.  
  77.     exportOpenRightHeader        = 1;
  78.     exportOpenLeftHeader         = 2;
  79.     exportOpenHeader             = 3;
  80.  
  81.     exportOpenRightFooter        = 4;
  82.     exportOpenLeftFooter         = 5;
  83.     exportOpenFooter             = 6;
  84.  
  85.     exportOpenFootnote             = 7;
  86.  
  87.     exportOpenMain                 = 8;
  88.  
  89.     exportWriteText                = 9;
  90.  
  91.     exportCloseRightHeader        = 10;
  92.     exportCloseLeftHeader        = 11;
  93.     exportCloseHeader             = 12;
  94.  
  95.     exportCloseRightFooter        = 13;
  96.     exportCloseLeftFooter        = 14;
  97.     exportCloseFooter            = 15;
  98.  
  99.     exportCloseFootnote            = 16;
  100.  
  101.     exportCloseMain                = 17;
  102.  
  103.     exportCloseAll                = 18;
  104.  
  105.     exportWriteResources        = 19;
  106.  
  107.  
  108. { Defines for CurrentStory }
  109.     rightHeaderStory= 1;
  110.     leftHeaderStory    = 2;
  111.     headerStory     = 3;
  112.     rightFooterStory= 4;
  113.     leftFooterStory = 5;
  114.     footerStory     = 6;
  115.     footnoteStory    = 7;
  116.     mainStory         = 8;
  117.  
  118. { types of pages for headers/footers }
  119.     everyPage         = 1;
  120.     leftPage         = 2;
  121.     rightPage         = 4;
  122.  
  123. { XTND 1.x reserved characters }
  124.     pageNumber         = $02;    { Current page number character }
  125.     footnoteChar     = $03;    { Footnote character in the footnote }
  126.     floatingPict     = $04;    { Floating picture marker }
  127.     footnoteMark     = $05;    { Footnote character in the text }
  128.     mergeBreak         = $06;    { Mail merge document break }
  129.     hardReturn         = $07;    { Hard return (does not create new paragraph) }
  130.     tabChar         = $09;    { Tab character }
  131.     newColumn         = $0B;    { Column break character }
  132.     newPage         = $0C;    { Page break character }
  133.     returnChar         = $0D;    { Paragraph break character }
  134.     shortDateChar    = $15;    { Assorted date characters }
  135.     abbrDateChar     = $16;
  136.     longDateChar     = $17;
  137.     dayAbbrDateChar = $18;    { Date characters with day of week included }
  138.     dayLongDateChar = $19;
  139.     timeChar         = $1A;    { Time character }
  140.     softHyphen         = $1F;    { Discretionary hyphen character }
  141.  
  142.     { Other character values }
  143.     enterChar        = $03;
  144.  
  145.     { XTND 1.x limits }
  146.     numParaFmts        = 9;            { Number of fields in a paragraph specification }
  147.     maxCols            = 10;            { Maximum number of columns allowed }
  148.     maxTabs            = 20;            { Maximum number of tabs allowed }
  149.     minGutter        = $00030000;    { (minimum gutter) 3 points as a Fixed number }
  150.     maxGutter        = $01200000;    { (maximum gutter) 288 points as a Fixed number }
  151.     dfltGutter        = $00090000;    { (default gutter) 9 points as a Fixed number }
  152.     
  153. { XTND 1.x text styles }
  154.     textPlain        = $0000;
  155.     textSuperScript    = $0020;
  156.     textSubScript    = $0040;
  157.     textNonbreaking    = $0080;
  158.     textSuperior    = $0100;
  159.     textStrikeThru    = $0200;
  160.     textAllCaps        = $0400;
  161.     textSmallCaps    = $0800;
  162.     textWordUnderline= $1000;
  163.     textDoubleUnderline= $2000;
  164.     textLowerCase    = $4000;
  165.  
  166. { XTND 1.x justification/tab alignment values }
  167.     textLeft        = 0;
  168.     textCenter        = 1;
  169.     textRight        = 2;
  170.     textJustified    = 3;        { For text }
  171.     textDecimal        = 3;        { For tabs }
  172.  
  173. { XTND 1.x text color values }
  174.     textWhite    = 0;
  175.     textBlack    = 1;
  176.     textRed        = 2;
  177.     textGreen    = 3;
  178.     textBlue    = 4;
  179.     textCyan    = 5;
  180.     textMagenta    = 6;
  181.     textYellow    = 7;
  182.     textOtherColor = 8;
  183.     
  184. TYPE
  185.     { Tab specifications record.  The tab array contains 20 of these.}
  186.         TabSpec = RECORD
  187.             tabJust:         SignedByte;    { Tab justification (left, right, center, aligned) }
  188.             tabLead:         SignedByte;    { Tab leader character (default is space) }
  189.             tabIndent:         Fixed;        { Tab indent in points from left page margin }
  190.             decAlign:         SignedByte;    { Tab alignment character (usually period) }
  191.         END;
  192.         TabSpecArray = ARRAY [0..19] of TabSpec;
  193.  
  194.  
  195.     { The pictMisc data structure is used to import a quickdraw picture }
  196.         pictMiscHdl            = ^pictMiscPtr;
  197.         pictMiscPtr            = ^pictMisc;
  198.         pictMisc = RECORD
  199.             thePicture:     PicHandle;        { handle to the quickdraw picture }
  200.             pictSize:         LongInt;        { Size of associated picture }
  201.             destRect:         Rect;            { Used for scaling the picture, OrigRect will be scaled to this rect }
  202.             origRect:         Rect;            { Used for cropping the picture, pictRect will be cropped to this rect }
  203.             reserved:         PACKED ARRAY[1..38] of Byte;    { Reserved, fill with zeros }
  204.         END;
  205.         
  206.     { Paragraph format record.  The ParaFormats array contains 9 Fixed values }
  207.     ParaFormat        = Fixed;
  208.     ParaFormats        = ARRAY [0..8] OF ParaFormat;
  209.     
  210.     { This is the parameter block for passing information to an import translator }
  211.         ImportParmBlkPtr = ^ImportParmBlock;
  212.         ImportParmBlock = RECORD
  213.                 textBuffer:     Ptr;        { Pointer to 256 bytes of data }
  214.                 directive:         INTEGER;    { Indicates the action to be performed }
  215.                 result:            OSErr;        { Return code, 0 if successful, error code otherwise }
  216.                 textLength:     LONGINT;    { Number of characters of information being returned }
  217.                 translatorState: INTEGER;    { Available for use by the translator }
  218.                 refNum:         INTEGER;    { Reference number of the fork to be read by the translator }
  219.                 txtFace:         INTEGER;    { Current text face }
  220.                 txtSize:         INTEGER;    { Current text font size }
  221.                 txtFont:         INTEGER;    { Current text font family number }
  222.                 txtColor:         INTEGER;    { Current text color (MacWrite II color value) }
  223.                 txtJust:         INTEGER;    { Justification of this text }
  224.                 unused1:         INTEGER;    { Must be zero }
  225.                 paraFmts:         ^ParaFormats;{ Pointer to this paragraph's format array }
  226.                 tabs:             ^TabSpecArray;{ Pointer to this paragraph's tab array }
  227.                 unused2:         BOOLEAN;    { Currently unused }
  228.                 numCols:         SignedByte;    { Number of columns expected }
  229.                 currentStory:     INTEGER;    { Header,Footer,Main Body, etc. }
  230.                 miscData:         LONGINT;    { For importing pictures, etc. }
  231.                 storyHeight:     INTEGER;    { Height of header,footer, etc. }
  232.                 decimalChar:     Char;        { Default char to align decimal tab on }
  233.                 autoHyphenate:     BOOLEAN;    { If TRUE, auto hyphenation is on }
  234.                 printRecord:     THPrint;    { Print record, if one is used, otherwise NIL }
  235.                 topMargin:        Fixed;        { Document top margin }
  236.                 bottomMargin:    Fixed;        { Document bottom margin }
  237.                 leftMargin:        Fixed;        { Document left margin }
  238.                 rightMargin:    Fixed;        { Document right margin }
  239.                 gutter:         Fixed;        { Space between columns }
  240.                 startPageNum:    INTEGER;    { Starting page number }
  241.                 startFootnoteNum:INTEGER;    { starting footnote number }
  242.                 footnoteText:     Ptr;        { If not empty, text associated with footnote, else auto }
  243.                 rulerShowing:     BOOLEAN;    { If TRUE, ruler is showing }
  244.                 doubleSided:     BOOLEAN;    { If TRUE, document has Left/Right pages }
  245.                 titlePage:         BOOLEAN;    { If TRUE, document has a title page (with no headers/footers) }
  246.                 endnotes:         BOOLEAN;    { If TRUE, footnotes are displayed as endnotes }
  247.                 showInvisibles: BOOLEAN;    { If TRUE, invisible characters will be displayed }
  248.                 showPageGuides: BOOLEAN;    { If TRUE, page guides will be displayed }
  249.                 showPictures:     BOOLEAN;    { If TRUE, pictures will be displayed }
  250.                 autoFootnotes:    BOOLEAN;    { If TRUE, footnotes will be numbered automatically }
  251.                 pagePoint:         Point;        { Position for page number within header/footer }
  252.                 datePoint:         Point;        { Position for date character within header/footer }
  253.                 timePoint:         Point;        { Position for time character within header/footer }
  254.                 globalHandle:    Handle;        { Handle to translator globals, if needed }
  255.                 smartQuotes:     BOOLEAN;    { If TRUE, smart quotes will be used }
  256.                 fractCharWidths:BOOLEAN;    { If TRUE, fractional character widths will be used }
  257.                 hRes:             INTEGER;    { The horizontal resolution of this document (default is 72) }
  258.                 vRes:             INTEGER;    { The vertical resolution of this document (default is 72) }
  259.                 windowRect:     Rect;        { May be used to specify document window placement and size }
  260.                 theReply:         SFReply;    { Standard reply record describing the file being translated }
  261.                 thisTranslator: TransDescribe;{ TransDescribe record describing this translator }
  262.             END;
  263.  
  264.  
  265.     { This is the parameter block for passing information to an export translator.}
  266.         ExportParmBlkPtr = ^ExportParmBlock;
  267.         ExportParmBlock = RECORD
  268.                 directive:         SignedByte;    { Indicates the action to be performed }
  269.                 filler1:         SignedByte;    { explicit padding }
  270.                 result:         ^OSErr;        { Pointer to return code, 0 if successful, error code otherwise }
  271.                 refNum:         ^INTEGER;    { Pointer to reference number of the file being written by the translator }
  272.                 textLength:     ^LONGINT;    { Pointer to number of characters being exported }
  273.                 globalHandle:     Handle;        { Do not change this value }
  274.                 reserved1:        LONGINT;    { Do not change this value }
  275.                 textBuffer:     Handle;        { Handle to the text being exported }
  276.                 txtFace:         ^INTEGER;    { Pointer to the current text face }
  277.                 txtSize:         ^INTEGER;    { Pointer to the current text font size }
  278.                 txtFont:         ^INTEGER;    { Pointer to the current text font family number }
  279.                 txtColor:         ^SignedByte;{ Pointer to the current text color (MacWrite II color value) }
  280.                 txtJust:         ^INTEGER;    { Pointer to the justification of this text }
  281.                 paraFmts:         ^ParaFormats;{ Pointer to this paragraph's format array }
  282.                 tabs:             ^TabSpecArray;{ Pointer to this paragraph's tab array }
  283.                 thePicture:     PicHandle;    { Handle to a quickdraw picture }
  284.                 pictRect:        Rect;        { Rectangle describing the display rect of the above picture }
  285.                 headerStatus:     INTEGER;    { Shows if header is on left/right/every page }
  286.                 footerStatus:     INTEGER;    { Shows if footer is on left/right/every page }
  287.                 currentStory:     INTEGER;    { Header, Footer, Main Body, etc. }
  288.                 numCols:         INTEGER;    { Number of columns in document }
  289.                 topMargin:        Fixed;        { Document top margin }
  290.                 bottomMargin:    Fixed;        { Document bottom margin }
  291.                 leftMargin:        Fixed;        { Document left margin }
  292.                 rightMargin:    Fixed;        { Document right margin }
  293.                 gutter:         Fixed;        { Space between columns }
  294.                 totalCharCount: LONGINT;    { Total number of chars in document (for Word 3.0) }
  295.                 footnoteOffset: LONGINT;    { If current story is a footnote, its offset in doc }
  296.                 footnoteText:     StringPtr;    { If !autoFootnotes, text for footnote (Pascal String) }
  297.                 startPageNum:     INTEGER;    { Starting page number }
  298.                 startFootnoteNum:INTEGER;    { Starting footnote number }
  299.                 rulerShowing:     BOOLEAN;    { if TRUE, ruler is showing }
  300.                 doubleSided:     BOOLEAN;    { if TRUE, document has Left/Right pages }
  301.                 titlePage:         BOOLEAN;    { If TRUE, document has a title page (with no headers/footers) }
  302.                 endnotes:         BOOLEAN;    { If TRUE, footnotes are displayed as endnotes }
  303.                 showInvisibles: BOOLEAN;    { If TRUE, invisible characters are displayed }
  304.                 showPageGuides: BOOLEAN;    { If TRUE, page guides are displayed }
  305.                 showPictures:     BOOLEAN;    { If TRUE, pictures are displayed }
  306.                 autoFootnotes:    BOOLEAN;    { If TRUE, footnotes are numbered automatically }
  307.                 footnotesExist: BOOLEAN;    { If TRUE, footnotes are being exported }
  308.                 printRecord:     THPrint;    { Print record for this document }
  309.                 pagePoint:         Point;        { Point where page number is displayed in header or footer }
  310.                 datePoint:         Point;        { Point where date character is displayed in header or footer }
  311.                 timePoint:         Point;        { Point where time character is displayed in header or footer }
  312.                 smartQuotes:     BOOLEAN;    { If TRUE, SmartQuotes are turned on }
  313.                 fractCharWidths:BOOLEAN;    { If TRUE, fractional character widths are turned on }
  314.                 hRes:             INTEGER;    { The horizontal resolution of this document }
  315.                 vRes:             INTEGER;    { The vertical resolution of this document }
  316.                 windowRect:     Rect;        { Rectangle specifying document window placement and size }
  317.                 theReply:         SFReply;    { Standard reply record describing the file being written }
  318.                 thisTranslator: TransDescribe;{ TransDescribe record describing this translator }
  319.             END;
  320.  
  321. {$ENDC}    { UsingXTNDTextTranslator }
  322.  
  323. {$IFC NOT UsingIncludes}
  324.     END.
  325. {$ENDC}
  326.  
  327.